home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Compilers / digital marsC compier / dm / include / Syms.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-03-16  |  2.8 KB  |  156 lines

  1. /* Copyright (C) 1986-2001 by Digital Mars. $Revision: 1.1.1.1 $ */
  2. #if __SC__ || __RCC__
  3. #pragma once
  4. #endif
  5.  
  6. #ifndef __SYMS_H
  7. #define __SYMS_H
  8.  
  9. /* Used when dealing with COFF files. */
  10.  
  11. #if __cplusplus
  12. extern "C" {
  13. #endif
  14.  
  15. #pragma pack(2)
  16.  
  17. struct syment
  18. {
  19. #define SYMNMLEN 8
  20.   union
  21.   {
  22.     char  _n_name[SYMNMLEN];
  23.     struct
  24.     {
  25.       long _n_zeroes;
  26.       long _n_offset;
  27.     } _n_n;
  28.     char *_n_nptr[2];
  29.   } _n;
  30.   long n_value;
  31.   short n_scnum;
  32.   unsigned short n_type;
  33.   char n_sclass;
  34.   char n_numaux;
  35. };
  36.  
  37. #define n_name _n._n_name
  38. #define n_nptr _n._n_nptr[1]
  39. #define n_zeroes _n._n_n._n_zeroes
  40. #define n_offset _n._n_n._n_offset
  41.  
  42. #define N_UNDEF 0
  43. #define N_ABS   -1
  44. #define N_DEBUG -2
  45. #define N_TV    -3
  46. #define P_TV    -4
  47.  
  48. #define _EF    ".ef"
  49.  
  50. #define T_NULL   0
  51. #define T_ARG    1
  52. #define T_CHAR   2
  53. #define T_SHORT  3
  54. #define T_INT    4
  55. #define T_LONG   5
  56. #define T_FLOAT  6
  57. #define T_DOUBLE 7
  58. #define T_STRUCT 8
  59. #define T_UNION  9
  60. #define T_ENUM   10
  61. #define T_MOE    11
  62. #define T_UCHAR  12
  63. #define T_USHORT 13
  64. #define T_UINT   14
  65. #define T_ULONG  15
  66.  
  67. #define DT_NON 0
  68. #define DT_PTR 1
  69. #define DT_FCN 2
  70. #define DT_ARY 3
  71.  
  72. #define N_BTMASK 017
  73. #define N_TMASK  060
  74. #define N_TMASK1 0300
  75. #define N_TMASK2 0360
  76. #define N_BTSHFT 4
  77. #define N_TSHIFT 2
  78.  
  79. #define BTYPE(A) ((A)&N_BTMASK)
  80. #define ISPTR(A) (((A)&N_TMASK)==(DT_PTR<<N_BTSHFT))
  81. #define ISFCN(A) (((A)&N_TMASK)==(DT_FCN<<N_BTSHFT))
  82. #define ISARY(A) (((A)&N_TMASK)==(DT_ARY<<N_BTSHFT))
  83. #define ISTAG(A) ((A)==C_STRTAG||(A)==C_UNTAG||(A)==C_ENTAG)
  84. #define INCREF(A) ((((A)&~N_BTMASK)<<N_TSHIFT)|(DT_PTR<<N_BTSHFT)|(A&N_BTMASK))
  85. #define DECREF(A) ((((A)>>N_TSHIFT)&~N_BTMASK)|((A)&N_BTMASK))
  86.  
  87. union auxent
  88. {
  89.   struct
  90.   {
  91.     long x_tagndx;
  92.     union
  93.     {
  94.       struct
  95.       {
  96.         unsigned short x_lnno;
  97.         unsigned short x_size;
  98.       } x_lnsz;
  99.       long x_fsize;
  100.     } x_misc;
  101.     union
  102.     {
  103.       struct
  104.       {
  105.         long x_lnnoptr;
  106.         long x_endndx;
  107.       }x_fcn;
  108.       struct
  109.       {
  110. #define DIMNUM 4
  111.         unsigned short  x_dimen[DIMNUM];
  112.       } x_ary;
  113.     }x_fcnary;
  114.     unsigned short x_tvndx;
  115.   } x_sym;
  116.   struct
  117.   {
  118. #define FILNMLEN 14
  119.     char x_fname[FILNMLEN];
  120.   } x_file;
  121.   struct
  122.   {
  123.     long x_scnlen;
  124.     unsigned short x_nreloc;
  125.     unsigned short x_nlinno;
  126.   } x_scn;
  127.   struct
  128.   {
  129.     long x_tvfill;
  130.     unsigned short x_tvlen;
  131.     unsigned short x_tvran[2];
  132.   }x_tv;
  133. };
  134.  
  135. #define SYMENT struct syment
  136. #define SYMESZ sizeof(SYMENT)
  137. #define AUXENT union auxent
  138. #define AUXESZ sizeof(AUXENT)
  139.  
  140. #define _ETEXT   "etext"
  141. #define _EDATA   "edata"
  142. #define _END     "end"
  143. #define _START   "_start"
  144. #define _TVORIG  "_tvorig"
  145. #define _TORIGIN "_torigin"
  146. #define _DORIGIN "_dorigin"
  147. #define _SORIGIN "_sorigin"
  148.  
  149. #pragma pack()
  150.  
  151. #if __cplusplus
  152. }
  153. #endif
  154.  
  155. #endif
  156.